package com.example.gfsquadwebviewproject.data.setting;

import android.content.Context;

import com.example.gfsquadwebviewproject.data.PreferenceKey;
import com.example.gfsquadwebviewproject.util.PreferencesUtils;

public class SettingConfigData {

    int login_view_timeout;//登录界面时间
    int setting_view_timeout;//设置界面时间

    int success_refresh_timeout;//加载成功后的刷新时间 分钟
    int failure_refresh_timeout;//加载失败后的刷新时间 秒

    Context context;

    public SettingConfigData(Context context) {
        this.context = context;
    }

    public int getLogin_view_timeout() {
        login_view_timeout = PreferencesUtils.getInt(context, PreferenceKey.LOGIN_VIEW_TIMEOUT,15);
        return login_view_timeout;
    }

    public void saveLogin_view_timeout(int login_view_timeout) {
        PreferencesUtils.putInt(context, PreferenceKey.LOGIN_VIEW_TIMEOUT,login_view_timeout);
        this.login_view_timeout = login_view_timeout;
    }

    public int getSetting_view_timeout() {
        setting_view_timeout = PreferencesUtils.getInt(context, PreferenceKey.SETTING_VIEW_TIMEOUT,60);

        return setting_view_timeout;
    }

    public void saveSetting_view_timeout(int setting_view_timeout) {
        PreferencesUtils.putInt(context, PreferenceKey.SETTING_VIEW_TIMEOUT,setting_view_timeout);
        this.setting_view_timeout = setting_view_timeout;
    }


    public int getSuccess_refresh_timeout() {
        success_refresh_timeout = PreferencesUtils.getInt(context, PreferenceKey.SUCCESS_REFRESH_TIMEOUT,30);
        return success_refresh_timeout;
    }

    public void saveSuccess_refresh_timeout(int success_refresh_timeout) {
        this.success_refresh_timeout = success_refresh_timeout;
        PreferencesUtils.putInt(context, PreferenceKey.SUCCESS_REFRESH_TIMEOUT,success_refresh_timeout);
    }

    public int getFailure_refresh_timeout() {
        failure_refresh_timeout = PreferencesUtils.getInt(context, PreferenceKey.FAILURE_REFRESH_TIMEOUT,30);
        return failure_refresh_timeout;
    }

    public void saveFailure_refresh_timeout(int failure_refresh_timeout) {
        this.failure_refresh_timeout = failure_refresh_timeout;
        PreferencesUtils.putInt(context, PreferenceKey.FAILURE_REFRESH_TIMEOUT,failure_refresh_timeout);
    }
}
